from PIL import Image

image = Image.open('guido.jpg')
for x in range(80, 310):
    for y in range(20, 360):
        if (x + y) % 2 == 0:
            color = (0, 0, 0)
        else:
            color = (255, 255, 255)
        # 通过Image对象的putpixel方法修改图像指定像素点
        image.putpixel((x, y), color)
image.show()
